{extend name="public/base"/}
{block name="body"}
<script type="text/javascript" src="https://apis.map.qq.com/tools/geolocation/min?key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77&referer=myapp"></script>

<div class="content">
    <a>
        <div class="list" id="map">
            <div class="listlt"><img src="__STATIC__/wechat/vip/images/my1.png"/></div>
            <div class="listrt">腾讯地图选择地址</div>
        </div>
        {assign name="layer" value="map_select_point" /}
        {include file="public/layer"/}
        <script type="text/javascript">
            var callback_map = function (data) {
                $("#layer_map").hide();
                console.log(data);
            };
            $(document).ready(function () {
                $("#map").click(function () {
                    $("#layer_map").show();
                });
            });
        </script>
    </a>

    <a>
        <div class="list" id="sao">
            <div class="listlt"><img src="__STATIC__/wechat/vip/images/my10.png"/></div>
            <div class="listrt">扫一扫</div>
        </div>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#sao").click(function () {
                    scanqrcode_obj.scan_qrcode();
                });
            });
        </script>
    </a>

    <a>
        <div class="list" id="address">
            <div class="listlt"><img src="__STATIC__/wechat/vip/images/my10.png"/></div>
            <div class="listrt">公众号自带地址导航</div>
        </div>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#address").click(function () {
                    var location = new Object();
                    location.lat = 39.094897;
                    location.lng = 117.183497;
                    location.name = '测试';
                    location.address = '测试地址';
                    location.infourl = 'http://www.baidu.com';
                    location_obj.open_location(location);
                })
            });
        </script>
    </a>

    <a>
        <div class="list" id="latlng">
            <div class="listlt"><img src="__STATIC__/wechat/vip/images/my10.png"/></div>
            <div class="listrt" onClick="getCurLocation()">定位当前精确经纬度</div>
        </div>

        <div class="list" id="latlng1">
            <div class="listlt"><img src="__STATIC__/wechat/vip/images/my10.png"/></div>
            <div class="listrt" onClick="geolocation.getIpLocation(showPosition,showErr)">定位当前粗糙经纬度</div>
        </div>
        <script type="text/JavaScript">
            //调用腾讯地图
            var geolocation = new qq.maps.Geolocation();
            var options = {timeout: 9000}; //定位的超时时间
            //判读是否超时
            function getCurLocation() {
                geolocation.getLocation(showPosition, showErr, options);
            }

            function showPosition(position) {
                console.log(position);
                alert(position.addr);
//                document.getElementById("demo").appendChild(document.createElement('pre')).innerHTML = JSON.stringify(position, null, 4);

            }

            function showErr() {
                document.getElementById("demo").appendChild(document.createElement('p')).innerHTML = "定位失败！";
            }

        </script>
    </a>
</div>
{/block}
